package com.crocodileQ.config;

import com.crocodileQ.properties.QiNiuOssProperties;
import com.crocodileQ.utils.QiNiuOssUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 七牛云
 */
@Slf4j
@Configuration
public class OssConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public QiNiuOssUtil aliOssUtil(QiNiuOssProperties qiNiuOssProperties){
        return new QiNiuOssUtil(
                qiNiuOssProperties.getEndpoint(),
                qiNiuOssProperties.getAccessKey(),
                qiNiuOssProperties.getSecretKey(),
                qiNiuOssProperties.getBucket());
    }
}

